package com.ruoyi.web.controller.business;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.system.domain.TbFollower;
import com.ruoyi.system.service.ITbFollowerService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 随从信息信息Controller
 * 
 * @author ruoyi
 * @date 2024-04-10
 */
@RestController
@RequestMapping("/business/follower")
public class TbFollowerController extends BaseController
{
    @Autowired
    private ITbFollowerService tbFollowerService;

    /**
     * 查询随从信息信息列表
     */
    @GetMapping("/list")
    public TableDataInfo list(TbFollower tbFollower)
    {
        startPage();
        List<TbFollower> list = tbFollowerService.selectTbFollowerList(tbFollower);
        return getDataTable(list);
    }

    /**
     * 导出随从信息信息列表
     */
    @PostMapping("/export")
    public void export(HttpServletResponse response, TbFollower tbFollower)
    {
        List<TbFollower> list = tbFollowerService.selectTbFollowerList(tbFollower);
        ExcelUtil<TbFollower> util = new ExcelUtil<TbFollower>(TbFollower.class);
        util.exportExcel(response, list, "随从信息信息数据");
    }

    /**
     * 获取随从信息信息详细信息
     */
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return success(tbFollowerService.selectTbFollowerById(id));
    }

    /**
     * 新增随从信息信息
     */
    @PostMapping
    public AjaxResult add(@RequestBody TbFollower tbFollower)
    {
        return toAjax(tbFollowerService.insertTbFollower(tbFollower));
    }

    /**
     * 修改随从信息信息
     */
    @PutMapping
    public AjaxResult edit(@RequestBody TbFollower tbFollower)
    {
        return toAjax(tbFollowerService.updateTbFollower(tbFollower));
    }

    /**
     * 删除随从信息信息
     */
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(tbFollowerService.deleteTbFollowerByIds(ids));
    }
}
